package com.ruoyi.weiriya.domain;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseIdEntity;
import com.ruoyi.common.utils.StringUtils;
import lombok.Data;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;

import java.util.Date;

/**
 * 门禁列对象 w_door
 * 
 * @author ruoyi
 * @date 2023-08-24
 */
@Data
@ApiModel(value = "WDoor", description = "门禁列对象")
public class WDoor extends BaseIdEntity
{
    private static final long serialVersionUID = 1L;

    /** id */
    @ApiModelProperty("id")
    private String id;

    /** 门禁名称 */
    @Excel(name = "门禁名称")
    @ApiModelProperty("门禁名称")
    private String name;

    /** 设备ID */
    @Excel(name = "设备ID")
    @ApiModelProperty("设备ID")
    private String deviceId;

    /** 区域ID */
    @Excel(name = "区域ID")
    @ApiModelProperty("区域ID")
    private String areaId;

    @TableField(exist = false)
    @ApiModelProperty("区域名称")
    private String areaName;

    /** 状态 */
    @Excel(name = "状态", readConverterExp = "1=正常,2=停用")
    @ApiModelProperty("状态(1正常，2停用)")
    private Integer status;

    /** 入口二维码 */
    @Excel(name = "入口二维码")
    @ApiModelProperty("入口二维码")
    private String inletUrl;

    /** 出口二维码 */
    @Excel(name = "出口二维码")
    @ApiModelProperty("出口二维码")
    private String exportUrl;

    /** 创建者 */
    @TableField(fill = FieldFill.INSERT)
    @ApiModelProperty("创建者")
    private String createBy;

    /** 创建时间 */
    @ApiModelProperty("创建时间")
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    /** 更新者 */
    @TableField(fill = FieldFill.UPDATE)
    @ApiModelProperty("更新者")
    private String updateBy;

    /** 更新时间 */
    @ApiModelProperty("更新时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;

    public <T> QueryWrapper<T> queryWrapper(){
        QueryWrapper<T> wrapper=new QueryWrapper<>();

        wrapper.like(StringUtils.isNotEmpty(id),"d.id" , id);
        wrapper.like(StringUtils.isNotEmpty(name),"d.name" , name);
        wrapper.like(StringUtils.isNotEmpty(deviceId),"d.device_id" , deviceId);
        wrapper.like(StringUtils.isNotEmpty(areaId),"d.area_id" , areaId);
        wrapper.like(StringUtils.isNotEmpty(inletUrl),"d.inlet_url" , inletUrl);
        wrapper.like(StringUtils.isNotEmpty(exportUrl),"d.export_url" , exportUrl);
        wrapper.orderByDesc("d.create_time");
        return wrapper;
    }

}
